<template>
  <div class="dashboard-container">
    <div class="dashboard-text">
      <span style="font-size: 30px">您好: {{ name }}</span>
      <div class="btn-container">
        <el-button class="btn-add" type="success" size="mini" @click="layout()">登出</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'Dashboard',
  computed: {
    ...mapGetters([
      'name'
    ])
  },
  methods: {
    async layout() {
      await this.$store.dispatch('user/logout')
      this.$router.push(`/login?redirect=${this.$route.fullPath}`)
    },
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 5px;
    height: 100vh;
    background-image: url('/images/index.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 20px;
  }

  .dashboard-text {

    font-family: "Arial";
    color: #333;
    display: flex;
    align-items: center;
    justify-content: space-between; /* 将内容分别对齐容器两侧 */



  }
}
</style>
